package yc.star.friend.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import yc.star.api.domain.vo.UserQuestionResultVO;
import yc.star.common.controller.BaseController;
import yc.star.common.domain.AppResult;
import yc.star.friend.domain.user.dto.UserSubmitDTO;
import yc.star.friend.service.IUserQuestionService;

@RestController
@RequestMapping("/user/question")
public class UserQuestionController extends BaseController {

    @Autowired
    private IUserQuestionService userQuestionService;

    @PostMapping("/submit")
    public AppResult<UserQuestionResultVO> submit(@RequestBody UserSubmitDTO submitDTO) {
        return userQuestionService.submit(submitDTO);
    }

    @PostMapping("/rabbit/submit")
    public AppResult<Void> rabbitSubmit(@RequestBody UserSubmitDTO submitDTO) {
        return toAppResult(userQuestionService.rabbitSubmit(submitDTO));
    }

    @GetMapping("/exe/result")
    public  AppResult<UserQuestionResultVO> exeResult(Long examId, Long questionId, String currentTime) {
        return AppResult.success(userQuestionService.exeResult(examId, questionId, currentTime));
    }

}